package com.dandelion.common.dao.auto.mapper;

import com.dandelion.common.dao.auto.pojo.OrderItem;
import com.dandelion.common.dao.auto.pojo.OrderItemCriteria;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

public interface OrderItemMapper {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table t_order_item
     *
     * @mbg.generated Mon Jun 18 12:33:43 CST 2018
     */
    @SelectProvider(type=OrderItemSqlProvider.class, method="countByExample")
    long countByExample(OrderItemCriteria example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table t_order_item
     *
     * @mbg.generated Mon Jun 18 12:33:43 CST 2018
     */
    @DeleteProvider(type=OrderItemSqlProvider.class, method="deleteByExample")
    int deleteByExample(OrderItemCriteria example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table t_order_item
     *
     * @mbg.generated Mon Jun 18 12:33:43 CST 2018
     */
    @Delete({
        "delete from t_order_item",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int deleteByPrimaryKey(Long id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table t_order_item
     *
     * @mbg.generated Mon Jun 18 12:33:43 CST 2018
     */
    @Insert({
        "insert into t_order_item (img, order_no, ",
        "sub_cat_id, leaf_cat_id, ",
        "model, item_num, ",
        "weight, length, ",
        "height, width, req, ",
        "is_deleted, create_time, ",
        "update_time)",
        "values (#{img,jdbcType=VARCHAR}, #{orderNo,jdbcType=VARCHAR}, ",
        "#{subCatId,jdbcType=INTEGER}, #{leafCatId,jdbcType=INTEGER}, ",
        "#{model,jdbcType=VARCHAR}, #{itemNum,jdbcType=INTEGER}, ",
        "#{weight,jdbcType=DECIMAL}, #{length,jdbcType=INTEGER}, ",
        "#{height,jdbcType=INTEGER}, #{width,jdbcType=INTEGER}, #{req,jdbcType=VARCHAR}, ",
        "#{isDeleted,jdbcType=TINYINT}, #{createTime,jdbcType=TIMESTAMP}, ",
        "#{updateTime,jdbcType=TIMESTAMP})"
    })
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="id", before=false, resultType=Long.class)
    int insert(OrderItem record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table t_order_item
     *
     * @mbg.generated Mon Jun 18 12:33:43 CST 2018
     */
    @InsertProvider(type=OrderItemSqlProvider.class, method="insertSelective")
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="id", before=false, resultType=Long.class)
    int insertSelective(OrderItem record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table t_order_item
     *
     * @mbg.generated Mon Jun 18 12:33:43 CST 2018
     */
    @SelectProvider(type=OrderItemSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="img", property="img", jdbcType=JdbcType.VARCHAR),
        @Result(column="order_no", property="orderNo", jdbcType=JdbcType.VARCHAR),
        @Result(column="sub_cat_id", property="subCatId", jdbcType=JdbcType.INTEGER),
        @Result(column="leaf_cat_id", property="leafCatId", jdbcType=JdbcType.INTEGER),
        @Result(column="model", property="model", jdbcType=JdbcType.VARCHAR),
        @Result(column="item_num", property="itemNum", jdbcType=JdbcType.INTEGER),
        @Result(column="weight", property="weight", jdbcType=JdbcType.DECIMAL),
        @Result(column="length", property="length", jdbcType=JdbcType.INTEGER),
        @Result(column="height", property="height", jdbcType=JdbcType.INTEGER),
        @Result(column="width", property="width", jdbcType=JdbcType.INTEGER),
        @Result(column="req", property="req", jdbcType=JdbcType.VARCHAR),
        @Result(column="is_deleted", property="isDeleted", jdbcType=JdbcType.TINYINT),
        @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP)
    })
    List<OrderItem> selectByExample(OrderItemCriteria example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table t_order_item
     *
     * @mbg.generated Mon Jun 18 12:33:43 CST 2018
     */
    @Select({
        "select",
        "id, img, order_no, sub_cat_id, leaf_cat_id, model, item_num, weight, length, ",
        "height, width, req, is_deleted, create_time, update_time",
        "from t_order_item",
        "where id = #{id,jdbcType=BIGINT}"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="img", property="img", jdbcType=JdbcType.VARCHAR),
        @Result(column="order_no", property="orderNo", jdbcType=JdbcType.VARCHAR),
        @Result(column="sub_cat_id", property="subCatId", jdbcType=JdbcType.INTEGER),
        @Result(column="leaf_cat_id", property="leafCatId", jdbcType=JdbcType.INTEGER),
        @Result(column="model", property="model", jdbcType=JdbcType.VARCHAR),
        @Result(column="item_num", property="itemNum", jdbcType=JdbcType.INTEGER),
        @Result(column="weight", property="weight", jdbcType=JdbcType.DECIMAL),
        @Result(column="length", property="length", jdbcType=JdbcType.INTEGER),
        @Result(column="height", property="height", jdbcType=JdbcType.INTEGER),
        @Result(column="width", property="width", jdbcType=JdbcType.INTEGER),
        @Result(column="req", property="req", jdbcType=JdbcType.VARCHAR),
        @Result(column="is_deleted", property="isDeleted", jdbcType=JdbcType.TINYINT),
        @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP)
    })
    OrderItem selectByPrimaryKey(Long id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table t_order_item
     *
     * @mbg.generated Mon Jun 18 12:33:43 CST 2018
     */
    @UpdateProvider(type=OrderItemSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") OrderItem record, @Param("example") OrderItemCriteria example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table t_order_item
     *
     * @mbg.generated Mon Jun 18 12:33:43 CST 2018
     */
    @UpdateProvider(type=OrderItemSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") OrderItem record, @Param("example") OrderItemCriteria example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table t_order_item
     *
     * @mbg.generated Mon Jun 18 12:33:43 CST 2018
     */
    @UpdateProvider(type=OrderItemSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(OrderItem record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table t_order_item
     *
     * @mbg.generated Mon Jun 18 12:33:43 CST 2018
     */
    @Update({
        "update t_order_item",
        "set img = #{img,jdbcType=VARCHAR},",
          "order_no = #{orderNo,jdbcType=VARCHAR},",
          "sub_cat_id = #{subCatId,jdbcType=INTEGER},",
          "leaf_cat_id = #{leafCatId,jdbcType=INTEGER},",
          "model = #{model,jdbcType=VARCHAR},",
          "item_num = #{itemNum,jdbcType=INTEGER},",
          "weight = #{weight,jdbcType=DECIMAL},",
          "length = #{length,jdbcType=INTEGER},",
          "height = #{height,jdbcType=INTEGER},",
          "width = #{width,jdbcType=INTEGER},",
          "req = #{req,jdbcType=VARCHAR},",
          "is_deleted = #{isDeleted,jdbcType=TINYINT},",
          "create_time = #{createTime,jdbcType=TIMESTAMP},",
          "update_time = #{updateTime,jdbcType=TIMESTAMP}",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int updateByPrimaryKey(OrderItem record);
}